/*
* Copyright 2008  Rice University
* All Rights Reserved
* 
*       Created by Erion Plaku, Lydia Kavraki
*       Physical and Biological Computing Group
*       Department of Computer Science
*       Rice University
*/

#include "OOPSMP/Graphics/GUtils/GGeometry/GWorkspace/CreateGWorkspace.H"
#include "OOPSMP/Graphics/GUtils/GGeometry/GWorkspace/GWorkspace2D.H"
#include "OOPSMP/Graphics/GUtils/GGeometry/GWorkspace/GWorkspace3D.H"
#include "OOPSMP/Graphics/GUtils/GGeometry/GWorkspace/GArticulatedWorkspace3D.H"

/**
*@brief Create corresponding graphical workspace from the given workspace
*/
OOPSMP::GWorkspace_t OOPSMP::CreateGWorkspace::instance(OOPSMP::Workspace_t ws)
{
	GWorkspace_t gws = NULL;

	if(dynamic_cast<Workspace2D_t>(ws))
		gws = new GWorkspace2D();
	else if(dynamic_cast<Workspace3D_t>(ws))
		gws = new GWorkspace3D();
	else if(dynamic_cast<ArticulatedWorkspace3D_t>(ws))
		gws = new GArticulatedWorkspace3D();
	
	if(gws)
		gws->setWorkspace(ws);
	
	return gws;
}



